package main

import (
	"fmt"
	"time"
	"ini/iniReader"
)

func main() {
	iniReader.Init()
    var listen iniReader.ListenFunc = iniReader.ListenFile
	infile := "config.ini"
	for {
		conf, err := iniReader.Watch(infile, listen)
		if err != nil {
			 fmt.Println(err.Error())
		} else {
			file,_ := conf.ReadIni()
			for _, data := range file {
				for sectionKey, section := range data {
					fmt.Println(sectionKey,section)
					for key, value := range section {
						fmt.Println(key,value)
					}
			 fmt.Println()
				}
		     }
		 time.Sleep(2 * time.Second)
	    }
    }
}